Every Cool value is an object. Objects contain a list of named attributes, a bit like records in C. In addition, each object belongs to a class. We use the following syntax for values in Cool:
v=X(a1=l1,a2=l2,…,an=ln)Read the syntax as follows: The value v is a member of class X containing the attributes a1,…,an whose locations are l1,…,ln. Note that the attributes have an associated location. Intuitively this means that there is some space in memory reserved for each attribute. The value v has dynamic type X.
For base objects of Cool (i.e., Ints, Strings, and Bools) we use a special case of the above syntax. Base objects have a class name, but their attributes are not like attributes of normal classes, because they cannot be modified. Therefore, we describe base objects using the following syntax:
\begin{array}{l} Int(5) \\ Bool(true) \\ String(4,{\tt"Cool"}) \end{array}For \tt Ints and \tt Bools, the meaning is obvious. \tt Strings contain two parts, the length and the actual sequence of ASCII characters.